﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using System.Web.Routing;

namespace Share.Bonnet.Pager {
    public static class ViewContextExtentions {

        /// <summary>
        /// Combines Routevalues with values found in the QueryString
        /// </summary>
        /// <param name="Context"></param>
        /// <returns></returns>
        public static RouteValueDictionary RouteQueryValues(this ViewContext Context) { 
            RouteValueDictionary Response;
            Response = new RouteValueDictionary(Context.RouteData.Values);

            foreach (string key in Context.HttpContext.Request.QueryString.Keys) {
                Response[key] = Context.HttpContext.Request.QueryString[key];
            }

            return Response;
        }

    }
}
